<!DOCTYPE html>
<html ng-app="account" class="ng-scope">
<head>
  <meta charset="UTF-8">
  <meta name="csrf-token" content="{{ csrf_token() }}">
  <script src="/home/kaidian/js/jquery-1.8.3.min.js" type="text/javascript"></script>
  <title class="ng-binding" ng-bind="pageTitle + ' - 叫外卖上ele.me'">注册 - 叫外卖上tianxia.com</title>

<link rel="stylesheet" type="text/css" href="{{asset('home/register/css/index.css')}}" media="all">
</head>
<body>
<div class="container" ng-class="{container: !noGlobalWrap}">
  <!-- ngIf: !noGlobalWrap --><header class="account-header ng-scope" ng-if="!noGlobalWrap">
    <a href="http://www.ele.me/"></a>
  </header><!-- end ngIf: !noGlobalWrap -->

  <!-- ngView:  --><div class="account-container ng-scope" ng-view=""><div class="register ng-scope"> <div class="account-main full" ng-show="!register.mailConfirm"> <div class="account-line"> <h3 class="account-title line-left">使用<span class="ng-binding" ng-bind="mobileMode ? '手机' : '邮箱'">邮箱</span>注册</h3> </div> <div class="register-aside"> <h3 class="register-title">已经注册过 ？</h3> <p class="register-info">请点击 <a href="{{url('/login')}}">直接登录</a></p> <!-- ngInclude: '/app/templates/_auth_links.tpl.html' --><div class="register-auth ng-scope" ng-include="'/app/templates/_auth_links.tpl.html'"><div class="ng-scope" ng-controller="AuthLinksCtrl"> <h4 class="auth-linktitle">可使用以下账号直接登录</h4>  <a class="auth-link qq" href="https://graph.qq.com/oauth2.0/authorize?client_id=101204453&amp;response_type=code&amp;scope=get_user_info&amp;state=e215d9bc90ea76307f7aaf830b6cb351216e716b&amp;redirect_uri=https://account.ele.me/auth/connect/qq?redirect_url=undefined" target="_blank">QQ</a>
<a href="https://api.weibo.com/oauth2/authorize?client_id=1772937595&amp;response_type=code&amp;redirect_uri=https://account.ele.me/auth/connect/weibo?redirect_url=undefined" class="auth-link weibo" ng-href="https://api.weibo.com/oauth2/authorize?client_id=1772937595&amp;response_type=code&amp;redirect_uri=https://account.ele.me/auth/connect/weibo?redirect_url=undefined" target="_blank">微博</a> </div></div> </div> <div class="register-form"> <!-- ngIf: mobileMode --><!-- ngInclude:  --><div class="ng-scope" ng-if="mobileMode" ng-include="" src="'/app/templates/_register_mobile.tpl.html'">



<!-- form表单 -->
<form class="account-form ng-scope ng-pristine ng-invalid ng-invalid-required" name="registerForm" ng-controller="registerFormCtrl" ng-submit="registerSubmit()" novalidate="" autocomplete="off" method="post" action="{{url('/home/user/add')}}"> 
    {{csrf_field()}}
  <div class="form-group error-group ng-hide" ng-show="!gotTokenError &amp;&amp; submitted &amp;&amp; (registerForm.$invalid || errInfo)"> 
    <p class="account-errtip ng-binding ng-hide" ng-show="errInfo" ng-bind="errInfo"></p> 
    <p class="account-errtip" ng-show="registerForm.account.$invalid">请填写正确的手机号</p> 
    <p class="account-errtip" ng-show="registerForm.verify.$invalid">请输入短信验证码</p> 
    <p class="account-errtip" ng-show="registerForm.password.$error.required">密码需要是字母或数字，最小6位，最大20位</p> 
    <p class="account-errtip" ng-show="registerForm.password.$invalid">密码需要是字母或数字，最小6位，最大20位</p> 
  </div> 

  <div class="form-group error-group ng-hide" ng-show="gotTokenError &amp;&amp; !submitted"> 
    <div class="account-errtip ng-hide" ng-show="errInfo &amp;&amp; errInfo.errorExists">该手机号已注册，请<a href="https://account.ele.me/login">直接登录</a></div> 
    <div class="account-errtip ng-binding ng-hide" ng-show="errInfo" ng-bind="errInfo"></div> 
    <p class="account-errtip" ng-show="registerForm.account.$invalid">请填写正确的邮箱</p>
  </div> 

  <div class="form-group compact"> 
    <label class="account-label" for="mobile">邮箱</label>
    <!-- 请填写正确的邮箱 -->  
    <input id="mobile" class="account-input ng-pristine ng-invalid ng-invalid-required ng-valid-pattern" name="email" placeholder="请输入你的邮箱" update-model-on="registerForm.getToken registerForm.submit blur" ng-model="register.mobile" ng-keydown="submitted = false" ng-pattern="/^1[3|4|5|8|7][0-9]{9}$/" required="" type="text" value=""> 
    <div id="tip" display="none" height="20px"></div>
  </div> 
  <div id="mobilecheck" display="none" height="20px"></div>
  <div class="form-group"> 
    <label class="account-label" for="mobileVerify">邮箱验证码</label>
    <!-- 邮箱验证码 -->
    <input id="mobileVerify" name="verify" class="account-input ng-pristine ng-invalid ng-invalid-required" ng-model="register.code" update-model-on="registerForm.submit blur" required="" type="text"placeholder="请输入验证码">
    <input  id="lang" class="account-btn verify ng-isolate-scope"  countdown="" tpl="重新发送(?time)" mode="text" time="60" status="smsRegisterCountdown" ng-class="{disabled: smsLoginCountdown === 'running' || audioRegisterCountdown === 'running'}" ng-click="sendMobileVerify('sms')" ng-keydown="submitted = false" type="button" value="获取验证码"/>
      
    <section> 
      <p class="countdown-tip ng-hide" ng-show="smsRegisterCountdown === 'running'">短信已发送，请输入短信中的验证码</p> 
      <p class="countdown-tip ng-hide" ng-show="smsRegisterCountdown === 'end' &amp;&amp; !gotTokenError &amp;&amp; audioRegisterCountdown !== 'running'"> 收不到短信？使用<a ng-class="{disabled: audioRegisterCountdown === 'running'}" ng-click="sendMobileVerify('audio')">语音验证码</a> 
      </p> 
      <div class="countdown-tip ng-hide" ng-show="smsRegisterCountdown === 'end' &amp;&amp; audioRegisterCountdown === 'running'"> <p>电话拨打中... 请留意你的手机来电</p> <p class="tip-lower ng-isolate-scope" countdown="" mode="text" time="60" tpl="?time 秒后可重新拨打" status="audioRegisterCountdown"></p> <p class="tip-lower">你也可以拨打 <b>4001-075-517</b> 获取验证码</p> 
      </div> 
    </section> 
  </div> 
  <div id="checkcode" display="none" height="20px"></div> 
  @if(session('info'))
  {
    <div id="checkcode" height="20px"><font color=red>{{session('info')}}</font></div>
  }
  @endif
  <div class="form-group"> <label class="account-label" for="password">设置密码</label>   <input style="display: none;" type="text">
    <input id="password" class="account-input ng-pristine ng-invalid ng-invalid-required ng-valid-maxlength ng-valid-minlength" name="password" placeholder="密码长度6-20字符" update-model-on="registerForm.submit blur" ng-model="register.password" ng-show="!pwShow" ng-keydown="submitted = false" ng-minlength="6" ng-maxlength="20" required="" type="password">

    <!-- 设置密码 -->
    <input id="password" class="account-input input-shadow ng-hide" ng-show="pwShow" ng-value="registerForm.password.$viewValue" placeholder="密码长度6-20字符" type="text"> 
    <div class="password-eye icon icon-eye" ng-mouseup="pwShow = 0" ng-mousedown="pwShow = 1">
        
    </div>

  </div> 
  <div id="tipcode" display="none" height="20px"></div> 
  <div class="form-group"> 
    <button id="bt" class="account-btn submit ng-binding" ng-class="{disabled: register.submitting}" ng-bind="register.submitting ? '提交中...': '同意协议并注册'">同意协议并注册
    </button> 
  </div> 
</form>





</div><!-- end ngIf: mobileMode --> <!-- ngIf: !mobileMode --> <!-- ngIf: mobileMode --><div ng-if="mobileMode" class="account-line register ng-scope"> <a href="https://h5.ele.me/service/agreement/" target="_blank">《使用条款和协议》</a> </div><!-- end ngIf: mobileMode --> </div> </div> <!-- ngIf: register.mailConfirm --> </div></div>

  <!-- ngIf: !noGlobalWrap --><footer class="account-footer ng-scope" ng-if="!noGlobalWrap">
    <p class="footer-line">
      <a class="footer-link" href="http://kaidian.ele.me/">我要开店</a> |
      <a class="footer-link" href="http://ele.me/support/about/contact">联系我们</a> |
      <a class="footer-link" href="http://ele.me/support/about/agreement">服务条款和协议</a> |
      <a class="footer-link" href="http://jobs.ele.me/">加入我们</a>
    </p>
    <p class="footer-line line-under">
      增值电信业务许可证 : <a class="footer-link" target="_blank" rel="nofollow" href="http://www.shca.gov.cn/">沪B2-20150033</a> |
      <a class="footer-link" target="_blank" rel="nofollow" href="http://www.miibeian.gov.cn/">沪ICP备 09007032</a> |
      <a class="footer-link" target="_blank" rel="nofollow" href="http://www.sgs.gov.cn/lz/licenseLink.do?method=licenceView&amp;entyId=20120305173227823">上海工商行政管理</a>
      Copyright ©2008-2015 ele.me, All Rights Reserved.
    </p>
  </footer><!-- end ngIf: !noGlobalWrap -->
</div>
    <script type="text/javascript">
      window.onload = function(){
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
            });

      // 添加事件
            $('#lang').on('click',function(){
               
                //取出input输入的值
                var email = $(this).parent().prev().prev().find('#mobile').val();
                //倒计时
                var count = 90;
                var countdown = setInterval(CountDown, 1000);

                function CountDown() {
                    $("#lang").attr("disabled", true);
                    $("#lang").val(count);
                    if (count == 0) {
                        $("#lang").val("获取验证码").removeAttr("disabled");
                        clearInterval(countdown);
                    }
                    count--;
                  }
                //ajax
                $.post('register/ajaxEmail', {email:email}, function(data){
                        if(data == '0')
                        {
                           
                            $("#lang").val("邮件已发送");
                            clearInterval(countdown);
                           
                        }else
                        {
                            alert('邮件发送失败,请刷新再发送');

                            
                        }
                }, 'json');
                
             });


            //验证邮箱
            
                $("#mobile").blur(function(){
                  if($("#mobile").val()=="")
                  {
                     $("#mobilecheck").css('display', 'block').html("<font color=red>邮箱不能为空</font>");

                     return false;
                  }

                  var email=$("#mobile").val();
                  if(!email.match(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/))
                  {
                    $("#mobilecheck").css('display', 'block').html("<font color=red>格式不正确！请重新输入</font>");
                    
                    return false;
                  }

                  //ajax
                  $.post('register/emailCheck', { email:email } ,function(data){//判断数据库中是否存在此用户名 重点$.get,$.post t1.php在下面
                    if(data==0) 
                    {
                      $("#tip").css('display', 'block').html("<font color=green>邮箱可用</font>");
                      
                    }
                    else 
                    {
                      $("#tip").css('display', 'block').html("<font color=red>已被占用</font>");}
                      
                    });
                });
                $("#mobile").focus(function()
                {
                  $("#tip").css('display', 'none');
                });
            
            //验证 验证码
            $("#mobileVerify").blur(function(){
                  if($("#mobileVerify").val()=="")
                  {
                     $("#checkcode").css('display', 'block').html("<font color=red>验证码不能为空</font>");
                      return false;
                  }

            });
            $("#mobileVerify").focus(function()
              {
                $("#checkcode").css('display', 'none');
              });
          
          //验证密码
           $("#password").blur(function(){
                  if($("#password").val()=="")
                  {
                     $("#tipcode").css('display', 'block').html("<font color=red>密码不能为空</font>");
                     return false;
                  }

                  if($("#password").val().length >= 6 && $("#password").val().length <= 20)
                  {
                      $("#tipcode").css('display', 'block').html("<font color=green>密码可用</font>");
                      
                  }
                  else 
                  {
                      $("#tipcode").css('display', 'block').html("<font color=red>密码长度6-20字符</font>");
                      return false;
                  }
            });
           $("#password").focus(function()
            {
              $("#tipcode").css('display', 'none');
            });
              

             
              
           
      }
    </script>
</body>
</html>
